package day0720;

public class RunnableDemo extends Thread {
    private int threadNumber;

    public RunnableDemo(int threadNumber) {
        this.threadNumber = threadNumber;
    }

    @Override
    public void run() {
        for (int i = 1; i <= 100; i++) {
            System.out.println("Thread " + threadNumber + ": " + i);
            try {
                Thread.sleep(300);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
    public static void main(String[] args) {
        RunnableDemo t1 = new RunnableDemo(1);
        RunnableDemo t2 = new RunnableDemo(2);
        RunnableDemo t3 = new RunnableDemo(3);
        t1.setPriority(1);
        t2.setPriority(10);
        t3.setPriority(5);
        t1.start();
        t2.start();
        t3.start();


    }
}
